package com.hcinfos.gsoo.adapter;

import java.util.List;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.hcinfos.gsoo.R;
import com.hcinfos.gsoo.config.Constants;
import com.hcinfos.gsoo.enity.ViewSuppDetail;
import com.hcinfos.gsoo.util.ImageUtil;
import com.hcinfos.gsoo.util.ImageUtil.ImageCallback;
import com.hcinfos.gsoo.util.LogUtil;

//关键字搜索数据的列表
public class PoiResultAdapter extends BaseAdapter {

	public List<PoiEnity> list;
	public Context context;
	private LayoutInflater mInflater;

	public PoiResultAdapter(Context context, List<PoiEnity> list) {
		this.list = list;
		this.context = context;
		mInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return list.get(position);

	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		final TypeHolder holder;
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.search_result_list_item,
					null);
			holder = new TypeHolder();
			holder.nameTv = (TextView) convertView.findViewById(R.id.result);

			convertView.setTag(holder);
		} else {
			holder = (TypeHolder) convertView.getTag();
		}
		PoiEnity search = list.get(position);
		holder.nameTv.setText(search.getName());
		return convertView;
	}

	private final class TypeHolder {
		TextView nameTv;

	}

	public void setDataChange(List<PoiEnity> list) {
		this.list = list;
		notifyDataSetChanged();
	}

}
